package com.rdc.qingkou.presenter;


import com.rdc.qingkou.base.BasePresenterImpl;
import com.rdc.qingkou.model.OneLevelCommentModel;
import com.rdc.qingkou.presenter.ipresenter.IOneLevelCommentPresenter;
import com.rdc.qingkou.ui.iview.IOneLevelCommentView;
import com.rdc.qingkou.vo.CommentOneLevelVO;

import java.util.List;


public class OneLevelCommentPresenter extends BasePresenterImpl<IOneLevelCommentView> implements IOneLevelCommentPresenter {

    private OneLevelCommentModel model;

    public OneLevelCommentPresenter() {
        model = new OneLevelCommentModel(this);
    }

    @Override
    public void appreciate(int id) {
        model.appreciate(id);
    }

    @Override
    public void appreciateError(String message) {
        if (isAttachView()) {
            getMvpView().appreciateError(message);
        }
    }

    @Override
    public void appreciateSuccess(int id, boolean flag) {
        if (isAttachView()) {
            getMvpView().appreciateSuccess(id, flag);
        }
    }

    @Override
    public void sendOneLevelComment(String input, Integer cardId, Integer userId) {
        model.sendOneLevelComment(input, cardId, userId);
    }

    @Override
    public void sendOneLevelCommentSuccess(CommentOneLevelVO c) {
        if (isAttachView()) {
            getMvpView().sendOneLevelCommentsSuccess(c);
        }
    }

    @Override
    public void sendOneLevelCommentError(String message) {
        if (isAttachView()) {
            getMvpView().sendOneLevelCommentsError(message);
        }
    }

    @Override
    public void getOneLevelComment(int cardId, int currentPage) {
        model.getOneLevelComment(cardId, currentPage);
    }

    @Override
    public void getOneLevelCommentSuccess(List<CommentOneLevelVO> hotList, List<CommentOneLevelVO> recentList) {
        if (isAttachView()) {
            getMvpView().getOneLevelCommentsSuccess(hotList, recentList);
        }
    }

    @Override
    public void getOneLevelCommentError(String message) {
        if (isAttachView()) {
            getMvpView().getOneLevelCommentsError(message);
        }
    }

    @Override
    public void loadMoreOneLevelComment(int cardId, int currentPage) {
        model.loadMoreOneLevelComment(cardId, currentPage);
    }

    @Override
    public void loadMoreOneLevelCommentSuccess(List<CommentOneLevelVO> recentList) {
        if (isAttachView()) {
            getMvpView().loadingOneLevelCommentsSuccess(recentList);
        }
    }

    @Override
    public void loadMoreOnrLevelCommentError(String message) {
        if (isAttachView()) {
            getMvpView().loadingOneLevelCommentsError(message);
        }
    }

    @Override
    public void clearDisposable() {
        model.clearDisposable();
    }


}
